<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String appid = request.getParameter("appid");
%>
<!DOCTYPE html>
<html>
<head>
    <title>服务机构管理服务项</title>
    <%@ include file="../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <%--<script src="${ctx}/js/ueditor/ueditor.config.js?t=${now}"></script>
    <script src="${ctx}/js/ueditor/ueditor.all.js"></script>--%>
    <style>
        .edui-dialog{
            z-index: 50000!important;
        }
    </style>
    <script>
        var appid = '<%=appid%>';
        var statusEnum = ${status};
        var searchStr = '${searchStr}';
        var searchInfo = ${searchInfo};
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><i class="fa fa-search"></i> 筛选查询</h5>
                        </div>
                        <div class="ibox-content ibox-content-search">
                            <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                                <!--
                                 上一个页面选中的   appid refCode bizCode
                                 或者这个页面选中的 appid refCode bizCode
                                -->
                                <input type="hidden" id="pAppId" name="pAppId" value="${not empty searchInfo ? searchInfo.pAppId:""}" />
                                <input type="hidden" id="pIsvPid" name="pIsvPid" value="${not empty searchInfo ? searchInfo.pIsvPid:""}" />
                                <input type="hidden" id="pRefCode" name="pRefCode" value="${not empty searchInfo ? searchInfo.pRefCode:""}" />
                                <input type="hidden" id="pBizCode" name="pBizCode" value="${not empty searchInfo ? searchInfo.pBizCode:""}" />
                                <!--
                                  为了新增的时候显示的冗余字段
                                -->
                                <input type="hidden" id="pBizName" name="pBizName" value="${not empty searchInfo ? searchInfo.pBizName:""}" />
                                <input type="hidden" id="pOrgName" name="pOrgName" value="${not empty searchInfo ? searchInfo.pOrgName:""}" />
                                <input type="hidden" id="pIsvName" name="pIsvName" value="${not empty searchInfo ? searchInfo.pIsvName:""}" />
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">查询服务项：</label>
                                    <div class="col-sm-5">
                                        <input type="text" id="bizName" name="bizName"
                                               value="${not empty searchInfo ? searchInfo.cBizName : ''}"
                                               onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                               class="form-control" placeholder="输入服务项" maxlength="30">
                                    </div>
                                    <label class="col-sm-1 control-label">状态：</label>
                                    <div class="col-sm-2">
                                        <select name="status" id="Pstatus" class="form-control" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${status}" var="item">
                                                <option value="${item.key}" ${not empty searchInfo && searchInfo.cStatus == item.key ? 'selected' : ''} >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="ibox-tools ibox-tools-search">
                                        <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">
                                            查询
                                        </button>
                                        <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-4">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><i class="fa fa-table"></i> 服务机构列表</h5>
                        </div>
                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-sm-5">
                                    <select class="form-control" id="selectType" onchange="selectType()">
                                        <option value="orgName">机构名称</option>
                                        <option value="bizName">业务类型</option>
                                        <option value="isvName">服务商名称</option>
                                    </select>
                                </div>
                                <div class="col-sm-7 input-group">
                                    <input type="text" class="form-control"
                                           value="${not empty searchInfo ? searchInfo.cOrgName : ''}"
                                           onkeydown="if(event.keyCode==13){doAppRefresh();return false;}"
                                           id="search" name="orgName" placeholder="输入机构名称">
                                    <span class="input-group-btn">
                                        <button type="button"
                                                class="btn btn-white" onclick="doAppRefresh()">查询
                                        </button>
                                    </span>
                                </div>
                            </div>
                            <table class='table table-striped table-hover'
                                   id="dataAppTable"
                                   data-toggle="table"
                                   data-url="${ctx}/bizApp/getGridBizAppData?t=${now}"
                                   data-pagination="true"
                                   data-height="340"
                                   data-side-pagination="server"
                                   data-striped="true"
                                   data-response-handler="handleServerResult"
                                   data-query-params-type=""
                                   data-query-params="getAppParams"
                                   data-page-number="${not empty searchInfo.cPageNo1 ? searchInfo.cPageNo1 : 1}"
                                   data-page-size="${not empty searchInfo.cPageSize1 ? searchInfo.cPageSize1 : defaultPageSize}"
                                   data-page-list="${pageList}"
                            >
                                <thead>
                                <tr>
                                    <th data-field="appid" data-visible="false">appid</th>
                                    <th data-field="bizName" data-align="center" data-formatter="onceCheck">业务类型</th>
                                    <th data-field="orgName" data-align="center">机构名称</th>
                                    <th data-field="isvName" data-align="center" >服务商</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5><i class="fa fa-table"></i> 服务项</h5>
                            <div class="ibox-tools col-sm-offset-2">
                                <c:if test="${userType == 'super' || not empty btnMap['addChildAppOrg']}">
                                    <button class="btn btn-primary btn-outline" onclick="add()">新增</button>
                                </c:if>
                                <c:if test="${userType == 'super' || not empty btnMap['editChildAppOrg']}">
                                    <button class="btn btn-primary btn-outline" onclick="edit()">编辑</button>
                                </c:if>
                                <c:if test="${userType == 'super' || not empty btnMap['delChildAppOrg']}">
                                    <button class="btn btn-primary btn-outline" onclick="validateBizApp()">删除</button>
                                </c:if>
                                <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                                <button class="btn btn-primary btn-outline" onclick="doback()">返回</button>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <table class='table table-striped table-hover'
                                   id="dataTable"  data-height="400"
                                   data-toggle="table"
                                   data-url="${ctx}/bizApp/getGridBizAppData?t=${now}"
                                   data-pagination="true"
                                   data-side-pagination="server"
                                   data-striped="true"
                                   data-response-handler="handleServerResult"
                                   data-query-params-type=""
                                   data-query-params="getParams"
                                   data-page-number="${not empty searchInfo.cPageNo2 ? searchInfo.cPageNo2 : 1}"
                                   data-page-size="${not empty searchInfo.cPageSize2 ? searchInfo.cPageSize2 : defaultPageSize}"
                                   data-page-list="${pageList}">
                                <thead>
                                <tr>
                                    <th data-field="id" data-visible="false">主键id</th>
                                    <th data-field="appid" data-visible="false">appid</th>
                                    <th data-field="bizCode" data-visible="false">bizCode</th>
                                    <th data-field="status" data-width="100px" data-align="center" data-formatter="formatterStatus" >状态</th>
                                    <th data-field="bizName" data-width="100px" data-align="center" >服务项名称</th>
                                    <th data-field="orgName"data-width="150px" data-align="center">机构名称</th>
                                    <th data-field="sortNum" data-width="80px" data-align="center">排序</th>
                                    <th data-field="creator" data-width="100px" data-formatter="formatterCreator" data-align="center" >创建人</th>
                                    <th data-field="operator" data-width="100px" data-formatter="formatterOperator" data-align="center">编辑人</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="text-center">${companyName}</div>
                </div>
            </div>
</div>
<div id="VueObj">
<div id="addBizApp" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="" style="font-weight: normal;">新增服务项</h4>
            </div>
            <div class="modal-body modal-body-height">
                <div class="row form-group">
                    <div class="col-sm-3  text-right">业务类型：</div>
                    <div class="col-sm-3  text-left">
                        {{addBizApp.bizName}}
                    </div>
                    <div class="col-sm-3  text-right">机构名称：</div>
                    <div class="col-sm-3 text-left">
                        {{addBizApp.orgName}}
                    </div>
                </div>
                <div class="row form-group">
                    <div class="col-sm-3 text-right">服务商：</div>
                    <div class="col-sm-9  text-left">
                        {{addBizApp.isvName}}
                    </div>
                </div>
                <div style="border: 1px solid #e4eaec;-webkit-box-shadow:0px 3px 3px #c8c8c8 ;
-moz-box-shadow:0px 3px 3px #c8c8c8 ;
box-shadow:0px 3px 3px #c8c8c8 ;">
                    <h4><i class="fa fa-table"></i> 服务项列表</h4>
                    <div class="row">
                        <form action="" id="winfom">
                            <div class="col-sm-3 text-right">查询服务项：</div>
                            <div class="col-sm-7"><input type="text" class="form-control" onkeydown="if(event.keyCode==13){doWinRefresh();return false;}" id="winBizName" name="bizName" placeholder="输入服务项名称" ></div>
                            <div class="col-sm-2"><button type="button" onclick="doWinRefresh()" class="btn btn-white">查询</button></div>
                        </form>
                    </div>
                    <table class='table table-striped table-hover'
                           id="WinTable"
                           data-toggle="table"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getWinParams"
                           data-page-size="${defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="checkBx" data-checkbox="true"  ></th>
                            <th data-field="parentName" data-align="center" >业务类型</th>
                            <th data-field="bizName" data-align="center" >服务项名称</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doSaveApp()">保存</button>
                <button class="btn btn-white" onclick="$('#addBizApp').modal('hide')" >取消</button>
            </div>
        </div>
    </div>
</div>

<div id="editBizApp" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 style="font-weight: normal;">编辑服务项</h4>
            </div>
            <div class="modal-body modal-body-height" >
                <h4><i class="fa fa-table"></i> 基本信息</h4>
                <hr>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label"><span style="color: red">*</span>状态：</label>
                        <div class="col-sm-4">
                            <select id="status" name="status" class="form-control" v-model="editBizApp.status">
                                <c:if test="${not empty status}">
                                    <c:forEach items="${status}" var="item">
                                        <option value="${item.key}" >${item.value}</option>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">服务项名称：</label>
                        <div class="col-sm-4">
                            {{editBizApp.bizName}}
                        </div>
                        <label class="col-sm-2 control-label">业务类型：</label>
                        <div class="col-sm-4">
                            {{addBizApp.bizName}}
                        </div>
                    </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">机构名称：</label>
                        <div class="col-sm-4">
                            {{addBizApp.orgName}}
                        </div>
                        <label class="col-sm-2 control-label">服务商：</label>
                        <div class="col-sm-4">
                            {{addBizApp.isvName}}
                        </div>
                    </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">服务有效期：</label>
                        <div class="col-sm-4">
                            <input type="text" id="validDay" name="validDay" placeholder="签约或购买后提供服务有效期" class="form-control" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" v-model="editBizApp.validDay">
                        </div>
                        <label class="col-sm-2 control-label"><div style="float: left;">天</div>   排序：</label>
                        <div class="col-sm-4">
                            <input type="text" id="sortNum" name="sortNum" class="form-control" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" v-model="editBizApp.sortNum">
                        </div>
                    </div>
                <h4><i class="fa fa-table"></i> 服务类型</h4>
                <hr>
                <form action="" id="editBizAppform">
                    <div class="row form-group">
                        <label class="col-sm-2 control-label"><span style="color: red;">*</span>服务提供方式：</label>
                        <div class="col-sm-8">
                            <select id="appType" name="appType" v-model="editBizApp.appType" required class="form-control" onchange="onchangeh5(this)">
                                <option value="">--请选择--</option>
                                <c:forEach items="${AppType}" var="item">
                                    <option value="${item.key}" >${item.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="tip"></div>
                    </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">
                            <span v-if="editBizApp.appType =='html'" id="h5" style="color: red;">*</span>
                            <span v-else id="h5" hidden="hidden" style="color: red;">*</span>h5地址：</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control"  id="appLinkUrl" name="appLinkUrl" v-model="editBizApp.appLinkUrl">
                        </div>
                     </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">
                            <span  style="color: red;">*</span>
                            服务说明：</label>
                        <div class="col-sm-8">
                            <script id="serviceContent"  type="text/html"></script>
                        </div>
                    </div>
                    <div class="row form-group">
                        <label class="col-sm-2 control-label">备注：</label>
                        <div class="col-sm-8">
                            <textarea id="remark" name="remark" cols="30" rows="10" class="form-control" v-model="editBizApp.remark"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doEditBizApp()">保存</button>
                <button class="btn btn-white" onclick="$('#editBizApp').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>


    <div id="delAppWin" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header text-center">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 >删除</h4>
                </div>
                <div class="modal-body modal-body-height" >
                    <div class="row">
                        <div class="col-sm-1 text-right error"></div>
                        <div class="col-sm-11 text-left"><span style="color: red">*</span>请输入删除原因</div>
                    </div>
                    <c:forEach items="${appOperReason}" var="item">
                        <div class="row">
                            <div class="col-sm-1 text-right"></div>
                            <div class="col-sm-11 text-left"><label ><input type="checkbox" name="del_text" value="${item.dictName}">${item.dictName}</label></div>
                        </div>
                    </c:forEach>
                    <div class="row">
                        <div class="col-sm-1 text-right"></div>
                        <div class="col-sm-11 text-left">
                            <textarea id="del_textarea" name="del_textarea" cols="30" rows="10" class="form-control"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="dodelApp()">删除</button>
                    <button class="btn btn-white" onclick="$('#delAppWin').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>
<%@ include file="../common/common-body.jsp" %>
<script src="${ctx}/js/app/bizAppChildrenBizMgr.js?t=${now}"></script>
</body>
</html>
